<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script type="text/javascript">
    function SystemManagerDeleteOrActive(id) {
        if(confirm("您确定要删除这个管理员吗？")) {
            window.location="userServlet.action?action=delete&id="+id;
        }
    }
    //让右侧菜单栏选中
    $(document).ready(function(){
        $("#SystemManager").addClass("active");
    });
</script>
<div class="data_list">
    <div class="data_list_title">
        系统管理员管理
    </div>
    <form name="myForm" class="form-search" method="post" action="">
        <button class="btn btn-success" type="button" style="margin-right: 50px;" onclick="javascript:window.location='userServlet.action?action=add'">添加</button>
    </form>
    <div>
        <table class="table table-striped table-bordered table-hover datatable">
            <thead>
            <tr>
                <th width="15%">序号</th>
                <th>用户名</th>
                <th>密码</th>
                <th width="20%">操作</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${requestScope.users}" var="user" varStatus="status">
                <tr>
                    <td>${status.count}</td>
                    <td>${user.username}</td>
                    <td>${user.password}</td>
                    <td>
                        <button class="btn btn-mini btn-info" type="button" onclick="javascript:window.location='userServlet.action?action=update&id=${user.id}'">修改</button>&nbsp;
                        <button class="btn btn-mini btn-danger" type="button" onclick="SystemManagerDeleteOrActive(${user.id})">删除</button>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </div>
    <div align="center"><font color="red"></font></div>
</div>
